
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const {defineConfig} = require('@vue/cli-service')


var webpack = require('webpack')
const path = require('path');
const fs = require('fs')
function resolve(dir) {
    return path.join(__dirname, dir)
}
// const isProduction = process.env.NODE_ENV === 'production'
module.exports = defineConfig(
    {
    
        chainWebpack: config => {
            //路径配置
            // '@bigdata-pkg':path.resolve(__dirname, './bigdata-pkg/src') 
            config.resolve.alias
                .set('assets', resolve('src/assets'))
                .set('styles', resolve('src/assets/styles'))
                // .set('@bigdata-pkg', path.resolve(__dirname, './bigdata-pkg/src'))
            // .set
        },
        publicPath: './',
        outputDir: 'dist',
        assetsDir: './static',
        indexPath: 'index.html',
        lintOnSave: false,//关闭语法检查,
        // webpack-dev-server 相关配置  
        devServer: {
            hot:true,
            open:true,
            port:9978,
            host:'localhost',
            proxy: {
                "/api": {
                    target: "http://135.31.64.140:4500",
                    changeOrigin: true,
                    ws: false,
                },
                "/inforelease": {
                    target: "http://135.31.66.84:8115", // http://135.31.66.84:8115
                    changeOrigin: true,
                    ws: false,
                },
                "/mtacl": {
                    target: "http://135.31.64.119:9000",
                    changeOrigin: true,
                    ws: false,
                },
            },
        },
        transpileDependencies: true,
    
        //其他配置....
        configureWebpack: {
            plugins: [
                new NodePolyfillPlugin()
            ],
            resolve: {
                extensions: ['.js', '.jsx', '.less', '.css'],
                alias: {
                    '@bigdata/bigdata-pkg': path.resolve(__dirname, './bigdata-pkg/src')
                },
            },
        }
    }
    
)